package com.foreknow.demo6;

import java.util.Scanner;

public class Test4 {

    /**
     * 对数组进行输入赋值并输出
     */
    public void input(int[] array){

    }



    /**
     * 遍历数组进行查找
     * @param array
     */
    public void m1(int[] array) {
        Scanner input = new Scanner(System.in);
        System.out.println("请输入数组的值：");
        int num = input.nextInt();
        //遍历
        for (int i = 0; i < array.length; i++) {
            if (array[i] == num) {
                System.out.println("找到了——————");
                break;
            }
        }
    }

    public static void main(String[] args) {
        Test4 test4 = new Test4();
        int[] array = {1, 2, 3, 4, 5};
        test4.m1(array);

    }


    }

